
#include "OutputParameter.h"

OutputParameterSp OutputParameter::Create( string name, string description, SType type )
{
	if ( name.empty() )
	{
		throw SArgumentException("Name cannot be empty.");
	}
	if ( Utility::IsComplexType(type) )
	{
		throw SArgumentException("The type is complex so you must to provide the typeDescriptor.");
	}		

	return OutputParameterSp( new OutputParameter(name, description, type) );
}

OutputParameterSp OutputParameter::Create( string name, string description, TypeDescriptorSp typeDescriptor )
{
	if ( name.empty() )
	{
		throw SArgumentException("Name cannot be empty.");
	}
	if ( !typeDescriptor )
	{
		throw SArgumentException("You must to set the typeDescriptor.");
	}
	if ( !typeDescriptor->IsValid() )
	{
		throw SArgumentException("The type descriptor is invalid");
	}

	return OutputParameterSp( new OutputParameter(name, description, typeDescriptor) );
}
